package com.gyg.executorDemo;

/**
 *创建线程方式一：继承Thread类
 */
public class TestThread01 extends Thread {
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println("线程方法体-线程名：" + Thread.currentThread().getName());
        }
    }

    public static void main(String[] args) {
        //创建一个线程对象
        TestThread01 testThread01 = new TestThread01();
        //调用start方法开启线程
        testThread01.start();

        for (int i = 0; i < 10; i++) {
            System.out.println("主线程方法-线程名：" + Thread.currentThread().getName());
        }
    }
}
